<?php


class User extends AdminBase
{

	//用户数据
	public function index(){
        $page=$this->GetId();
		if ($this->post()){
			$nickName=$this->input->post()['nickName'];
			$data['list']=$this->db->like('nickName',$nickName,'both')->limit(15,$page)->get('user')->result_array();
		}else{
			$data['list']=$this->db->limit(15,$page)->get('user')->result_array();
		}
		$this->load->library('pagination');
		$config['base_url'] = '/user/index/';
		$config['total_rows'] = count($this->db->get('user')->result_array());
		$config['per_page'] =15;

		$this->pagination->initialize($config);
		$data['pages']=$this->pagination->create_links();
		$this->load->view('user/index',$data);
	}


	//删除用户
	public function del(){
	$id=$this->PostId();
		$res=$this->db->delete('user', array('user_id'=>$id));
		if ($res){
			$this->show(['code'=>1,'msg'=>'删除成功']);
		}else{
			$this->show(['code'=>0,'msg'=>'删除失败']);
		}

	}




}
